<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP Project, Glasgow University, 1992-2000

-}</span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE CPP, ScopedTypeVariables, LambdaCase #-}</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span class="hs-comment">-- | Defines basic functions for printing error messages.</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- It's hard to put these functions anywhere else without causing</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- some unnecessary loops in the module dependency graph.</span><span>
</span><span id="line-13"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Utils.Panic</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-14"></span><span>     </span><span class="annot"><a href="GHC.Utils.Panic.html#GhcException"><span class="hs-identifier">GhcException</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#showGhcException"><span class="hs-identifier">showGhcException</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>     </span><span class="annot"><a href="GHC.Utils.Panic.html#throwGhcException"><span class="hs-identifier">throwGhcException</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier">throwGhcExceptionIO</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-16"></span><span>     </span><span class="annot"><a href="GHC.Utils.Panic.html#handleGhcException"><span class="hs-identifier">handleGhcException</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>     </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#progName"><span class="hs-identifier">GHC.Utils.Panic.Plain.progName</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>     </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#pgmError"><span class="hs-identifier">pgmError</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span>     </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier">panic</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#sorry"><span class="hs-identifier">sorry</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#assertPanic"><span class="hs-identifier">assertPanic</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Debug.Trace.html#trace"><span class="hs-identifier">trace</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>     </span><span class="annot"><a href="GHC.Utils.Panic.html#panicDoc"><span class="hs-identifier">panicDoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#sorryDoc"><span class="hs-identifier">sorryDoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#pgmErrorDoc"><span class="hs-identifier">pgmErrorDoc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span>     </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#cmdLineError"><span class="hs-identifier">cmdLineError</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#cmdLineErrorIO"><span class="hs-identifier">cmdLineErrorIO</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>
</span><span id="line-25"></span><span>     </span><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#Exception"><span class="hs-identifier">Exception.Exception</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#showException"><span class="hs-identifier">showException</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#safeShowException"><span class="hs-identifier">safeShowException</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>     </span><span class="annot"><a href="../../base/src/Control.Exception.Base.html#try"><span class="hs-identifier">try</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#tryMost"><span class="hs-identifier">tryMost</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Conc.Sync.html#throwTo"><span class="hs-identifier">throwTo</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span>     </span><span class="annot"><a href="GHC.Utils.Panic.html#withSignalHandlers"><span class="hs-identifier">withSignalHandlers</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-32"></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier">SDoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#showSDocUnsafe"><span class="hs-identifier">showSDocUnsafe</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html"><span class="hs-identifier">GHC.Utils.Panic.Plain</span></a></span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Exception.html"><span class="hs-identifier">GHC.Utils.Exception</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Exception</span></span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#"><span class="hs-identifier">Control.Monad.IO.Class</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../exceptions/src/Control.Monad.Catch.html#"><span class="hs-identifier">Control.Monad.Catch</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">MC</span></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Concurrent.html#"><span class="hs-identifier">Control.Concurrent</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Typeable.html#"><span class="hs-identifier">Data.Typeable</span></a></span><span>      </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Typeable.html#cast"><span class="hs-identifier">cast</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Debug.Trace.html#"><span class="hs-identifier">Debug.Trace</span></a></span><span>        </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Debug.Trace.html#trace"><span class="hs-identifier">trace</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Unsafe.html#"><span class="hs-identifier">System.IO.Unsafe</span></a></span><span class="hs-cpp">

#if !defined(mingw32_HOST_OS)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Posix.Signals</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">S</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">
#if defined(mingw32_HOST_OS)
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.ConsoleHandler.html#"><span class="hs-identifier">GHC.ConsoleHandler</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">S</span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.Mem.Weak.html#"><span class="hs-identifier">System.Mem.Weak</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Weak.html#deRefWeak"><span class="hs-identifier">deRefWeak</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span class="hs-comment">-- | GHC's own exception type</span><span>
</span><span id="line-56"></span><span class="hs-comment">--   error messages all take the form:</span><span>
</span><span id="line-57"></span><span class="hs-comment">--</span><span>
</span><span id="line-58"></span><span class="hs-comment">--  @</span><span>
</span><span id="line-59"></span><span class="hs-comment">--      \&lt;location&gt;: \&lt;error&gt;</span><span>
</span><span id="line-60"></span><span class="hs-comment">--  @</span><span>
</span><span id="line-61"></span><span class="hs-comment">--</span><span>
</span><span id="line-62"></span><span class="hs-comment">--   If the location is on the command line, or in GHC itself, then</span><span>
</span><span id="line-63"></span><span class="hs-comment">--   \&lt;location&gt;=&quot;ghc&quot;.  All of the error types below correspond to</span><span>
</span><span id="line-64"></span><span class="hs-comment">--   a \&lt;location&gt; of &quot;ghc&quot;, except for ProgramError (where the string is</span><span>
</span><span id="line-65"></span><span class="hs-comment">--  assumed to contain a location already, so we don't print one).</span><span>
</span><span id="line-66"></span><span>
</span><span id="line-67"></span><span class="hs-keyword">data</span><span> </span><span id="GhcException"><span class="annot"><a href="GHC.Utils.Panic.html#GhcException"><span class="hs-identifier hs-var">GhcException</span></a></span></span><span>
</span><span id="line-68"></span><span>  </span><span class="hs-comment">-- | Some other fatal signal (SIGHUP,SIGTERM)</span><span>
</span><span id="line-69"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="Signal"><span class="annot"><a href="GHC.Utils.Panic.html#Signal"><span class="hs-identifier hs-var">Signal</span></a></span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span>  </span><span class="hs-comment">-- | Prints the short usage msg after the error</span><span>
</span><span id="line-72"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="UsageError"><span class="annot"><a href="GHC.Utils.Panic.html#UsageError"><span class="hs-identifier hs-var">UsageError</span></a></span></span><span>   </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-73"></span><span>
</span><span id="line-74"></span><span>  </span><span class="hs-comment">-- | A problem with the command line arguments, but don't print usage.</span><span>
</span><span id="line-75"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="CmdLineError"><span class="annot"><a href="GHC.Utils.Panic.html#CmdLineError"><span class="hs-identifier hs-var">CmdLineError</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-76"></span><span>
</span><span id="line-77"></span><span>  </span><span class="hs-comment">-- | The 'impossible' happened.</span><span>
</span><span id="line-78"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Panic"><span class="annot"><a href="GHC.Utils.Panic.html#Panic"><span class="hs-identifier hs-var">Panic</span></a></span></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-79"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="PprPanic"><span class="annot"><a href="GHC.Utils.Panic.html#PprPanic"><span class="hs-identifier hs-var">PprPanic</span></a></span></span><span>     </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-80"></span><span>
</span><span id="line-81"></span><span>  </span><span class="hs-comment">-- | The user tickled something that's known not to work yet,</span><span>
</span><span id="line-82"></span><span>  </span><span class="hs-comment">--   but we're not counting it as a bug.</span><span>
</span><span id="line-83"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Sorry"><span class="annot"><a href="GHC.Utils.Panic.html#Sorry"><span class="hs-identifier hs-var">Sorry</span></a></span></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-84"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="PprSorry"><span class="annot"><a href="GHC.Utils.Panic.html#PprSorry"><span class="hs-identifier hs-var">PprSorry</span></a></span></span><span>     </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span>  </span><span class="hs-comment">-- | An installation problem.</span><span>
</span><span id="line-87"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="InstallationError"><span class="annot"><a href="GHC.Utils.Panic.html#InstallationError"><span class="hs-identifier hs-var">InstallationError</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-88"></span><span>
</span><span id="line-89"></span><span>  </span><span class="hs-comment">-- | An error in the user's code, probably.</span><span>
</span><span id="line-90"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ProgramError"><span class="annot"><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-91"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="PprProgramError"><span class="annot"><a href="GHC.Utils.Panic.html#PprProgramError"><span class="hs-identifier hs-var">PprProgramError</span></a></span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-92"></span><span>
</span><span id="line-93"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680788587"><span id="local-6989586621680788590"><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#Exception"><span class="hs-identifier hs-type">Exception</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#GhcException"><span class="hs-identifier hs-type">GhcException</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-94"></span><span>  </span><span id="local-6989586621680788585"><span class="annot"><span class="annottext">fromException :: SomeException -&gt; Maybe GhcException
</span><a href="../../base/src/GHC.Exception.Type.html#fromException"><span class="hs-identifier hs-var hs-var hs-var hs-var">fromException</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#SomeException"><span class="hs-identifier hs-type">SomeException</span></a></span><span> </span><span id="local-6989586621680788575"><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621680788575"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-95"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680788574"><span class="annot"><span class="annottext">GhcException
</span><a href="#local-6989586621680788574"><span class="hs-identifier hs-var">ge</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">e -&gt; Maybe GhcException
forall a b. (Typeable a, Typeable b) =&gt; a -&gt; Maybe b
</span><a href="../../base/src/Data.Typeable.html#cast"><span class="hs-identifier hs-var">cast</span></a></span><span> </span><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621680788575"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; Maybe GhcException
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">GhcException
</span><a href="#local-6989586621680788574"><span class="hs-identifier hs-var">ge</span></a></span><span>
</span><span id="line-96"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680788573"><span class="annot"><span class="annottext">PlainGhcException
</span><a href="#local-6989586621680788573"><span class="hs-identifier hs-var">pge</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">e -&gt; Maybe PlainGhcException
forall a b. (Typeable a, Typeable b) =&gt; a -&gt; Maybe b
</span><a href="../../base/src/Data.Typeable.html#cast"><span class="hs-identifier hs-var">cast</span></a></span><span> </span><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621680788575"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; Maybe GhcException
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(GhcException -&gt; Maybe GhcException)
-&gt; GhcException -&gt; Maybe GhcException
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-97"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">PlainGhcException
</span><a href="#local-6989586621680788573"><span class="hs-identifier hs-var">pge</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-98"></span><span>          </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#PlainSignal"><span class="hs-identifier hs-type">PlainSignal</span></a></span><span> </span><span id="local-6989586621680788571"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680788571"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#Signal"><span class="hs-identifier hs-var">Signal</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680788571"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-99"></span><span>          </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#PlainUsageError"><span class="hs-identifier hs-type">PlainUsageError</span></a></span><span> </span><span id="local-6989586621680788569"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788569"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#UsageError"><span class="hs-identifier hs-var">UsageError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788569"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-100"></span><span>          </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#PlainCmdLineError"><span class="hs-identifier hs-type">PlainCmdLineError</span></a></span><span> </span><span id="local-6989586621680788567"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788567"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#CmdLineError"><span class="hs-identifier hs-var">CmdLineError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788567"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-101"></span><span>          </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#PlainPanic"><span class="hs-identifier hs-type">PlainPanic</span></a></span><span> </span><span id="local-6989586621680788565"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788565"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#Panic"><span class="hs-identifier hs-var">Panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788565"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-102"></span><span>          </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#PlainSorry"><span class="hs-identifier hs-type">PlainSorry</span></a></span><span> </span><span id="local-6989586621680788563"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788563"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#Sorry"><span class="hs-identifier hs-var">Sorry</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788563"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-103"></span><span>          </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#PlainInstallationError"><span class="hs-identifier hs-type">PlainInstallationError</span></a></span><span> </span><span id="local-6989586621680788561"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788561"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#InstallationError"><span class="hs-identifier hs-var">InstallationError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788561"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-104"></span><span>          </span><span class="annot"><a href="GHC.Utils.Panic.Plain.html#PlainProgramError"><span class="hs-identifier hs-type">PlainProgramError</span></a></span><span> </span><span id="local-6989586621680788559"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788559"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-var">ProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788559"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-105"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe GhcException
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-106"></span><span>
</span><span id="line-107"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680788554"><span id="local-6989586621680788556"><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#GhcException"><span class="hs-identifier hs-type">GhcException</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-108"></span><span>  </span><span id="local-6989586621680788552"><span class="annot"><span class="annottext">showsPrec :: Int -&gt; GhcException -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showsPrec"><span class="hs-identifier hs-var hs-var hs-var hs-var">showsPrec</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680788550"><span class="annot"><span class="annottext">e :: GhcException
</span><a href="#local-6989586621680788550"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-type">ProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; ShowS
</span><a href="GHC.Utils.Panic.html#showGhcException"><span class="hs-identifier hs-var">showGhcException</span></a></span><span> </span><span class="annot"><span class="annottext">GhcException
</span><a href="#local-6989586621680788550"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-109"></span><span>  </span><span class="annot"><a href="../../base/src/GHC.Show.html#showsPrec"><span class="hs-identifier hs-var">showsPrec</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680788549"><span class="annot"><span class="annottext">e :: GhcException
</span><a href="#local-6989586621680788549"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Panic.html#CmdLineError"><span class="hs-identifier hs-type">CmdLineError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&lt;command line&gt;: &quot;</span></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; ShowS
</span><a href="GHC.Utils.Panic.html#showGhcException"><span class="hs-identifier hs-var">showGhcException</span></a></span><span> </span><span class="annot"><span class="annottext">GhcException
</span><a href="#local-6989586621680788549"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-110"></span><span>  </span><span class="annot"><a href="../../base/src/GHC.Show.html#showsPrec"><span class="hs-identifier hs-var">showsPrec</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680788546"><span class="annot"><span class="annottext">GhcException
</span><a href="#local-6989586621680788546"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="GHC.Utils.Panic.Plain.html#progName"><span class="hs-identifier hs-var">progName</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;: &quot;</span></span><span> </span><span class="annot"><span class="annottext">ShowS -&gt; ShowS -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; ShowS
</span><a href="GHC.Utils.Panic.html#showGhcException"><span class="hs-identifier hs-var">showGhcException</span></a></span><span> </span><span class="annot"><span class="annottext">GhcException
</span><a href="#local-6989586621680788546"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-111"></span><span>
</span><span id="line-112"></span><span class="hs-comment">-- | Show an exception as a string.</span><span>
</span><span id="line-113"></span><span id="local-6989586621680788711"><span class="annot"><a href="GHC.Utils.Panic.html#showException"><span class="hs-identifier hs-type">showException</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#Exception"><span class="hs-identifier hs-type">Exception</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680788711"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680788711"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span></span><span>
</span><span id="line-114"></span><span id="showException"><span class="annot"><span class="annottext">showException :: forall e. Exception e =&gt; e -&gt; String
</span><a href="GHC.Utils.Panic.html#showException"><span class="hs-identifier hs-var hs-var">showException</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">e -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span class="hs-comment">-- | Show an exception which can possibly throw other exceptions.</span><span>
</span><span id="line-117"></span><span class="hs-comment">-- Used when displaying exception thrown within TH code.</span><span>
</span><span id="line-118"></span><span id="local-6989586621680788709"><span class="annot"><a href="GHC.Utils.Panic.html#safeShowException"><span class="hs-identifier hs-type">safeShowException</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#Exception"><span class="hs-identifier hs-type">Exception</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680788709"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680788709"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span></span><span>
</span><span id="line-119"></span><span id="safeShowException"><span class="annot"><span class="annottext">safeShowException :: forall e. Exception e =&gt; e -&gt; IO String
</span><a href="GHC.Utils.Panic.html#safeShowException"><span class="hs-identifier hs-var hs-var">safeShowException</span></a></span></span><span> </span><span id="local-6989586621680788531"><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621680788531"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-120"></span><span>    </span><span class="hs-comment">-- ensure the whole error message is evaluated inside try</span><span>
</span><span id="line-121"></span><span>    </span><span id="local-6989586621680788530"><span class="annot"><span class="annottext">Either SomeException String
</span><a href="#local-6989586621680788530"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO String -&gt; IO (Either SomeException String)
forall e a. Exception e =&gt; IO a -&gt; IO (Either e a)
</span><a href="../../base/src/Control.Exception.Base.html#try"><span class="hs-identifier hs-var">try</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; IO String
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO String) -&gt; String -&gt; IO String
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">ShowS
forall {a}. [a] -&gt; [a]
</span><a href="#local-6989586621680788528"><span class="hs-identifier hs-var">forceList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">e -&gt; String
forall e. Exception e =&gt; e -&gt; String
</span><a href="GHC.Utils.Panic.html#showException"><span class="hs-identifier hs-var">showException</span></a></span><span> </span><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621680788531"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-122"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Either SomeException String
</span><a href="#local-6989586621680788530"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-123"></span><span>        </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621680788527"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788527"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO String
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788527"><span class="hs-identifier hs-var">msg</span></a></span><span>
</span><span id="line-124"></span><span>        </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621680788526"><span class="annot"><span class="annottext">SomeException
</span><a href="#local-6989586621680788526"><span class="hs-identifier hs-var">e'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SomeException -&gt; IO String
forall e. Exception e =&gt; e -&gt; IO String
</span><a href="GHC.Utils.Panic.html#safeShowException"><span class="hs-identifier hs-var">safeShowException</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SomeException
</span><a href="#local-6989586621680788526"><span class="hs-identifier hs-var">e'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#SomeException"><span class="hs-identifier hs-type">SomeException</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-125"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-126"></span><span>        </span><span id="local-6989586621680788528"><span class="annot"><span class="annottext">forceList :: [a] -&gt; [a]
</span><a href="#local-6989586621680788528"><span class="hs-identifier hs-var hs-var">forceList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-127"></span><span>        </span><span class="annot"><a href="#local-6989586621680788528"><span class="hs-identifier hs-var">forceList</span></a></span><span> </span><span id="local-6989586621680788525"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621680788525"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621680788524"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680788524"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680788523"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680788523"><span class="hs-identifier hs-var">xt</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680788524"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a]
</span><a href="#local-6989586621680788528"><span class="hs-identifier hs-var">forceList</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680788523"><span class="hs-identifier hs-var">xt</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680788525"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-128"></span><span>
</span><span id="line-129"></span><span class="hs-comment">-- | Append a description of the given exception to this string.</span><span>
</span><span id="line-130"></span><span class="hs-comment">--</span><span>
</span><span id="line-131"></span><span class="hs-comment">-- Note that this uses 'GHC.Driver.Session.unsafeGlobalDynFlags', which may have some</span><span>
</span><span id="line-132"></span><span class="hs-comment">-- uninitialized fields if invoked before 'GHC.initGhcMonad' has been called.</span><span>
</span><span id="line-133"></span><span class="hs-comment">-- If the error message to be printed includes a pretty-printer document</span><span>
</span><span id="line-134"></span><span class="hs-comment">-- which forces one of these fields this call may bottom.</span><span>
</span><span id="line-135"></span><span class="annot"><a href="GHC.Utils.Panic.html#showGhcException"><span class="hs-identifier hs-type">showGhcException</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#GhcException"><span class="hs-identifier hs-type">GhcException</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Show.html#ShowS"><span class="hs-identifier hs-type">ShowS</span></a></span><span>
</span><span id="line-136"></span><span id="showGhcException"><span class="annot"><span class="annottext">showGhcException :: GhcException -&gt; ShowS
</span><a href="GHC.Utils.Panic.html#showGhcException"><span class="hs-identifier hs-var hs-var">showGhcException</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PlainGhcException -&gt; ShowS
</span><a href="GHC.Utils.Panic.Plain.html#showPlainGhcException"><span class="hs-identifier hs-var">showPlainGhcException</span></a></span><span> </span><span class="annot"><span class="annottext">(PlainGhcException -&gt; ShowS)
-&gt; (GhcException -&gt; PlainGhcException) -&gt; GhcException -&gt; ShowS
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-glyph">case</span><span>
</span><span id="line-137"></span><span>  </span><span class="annot"><a href="GHC.Utils.Panic.html#Signal"><span class="hs-identifier hs-type">Signal</span></a></span><span> </span><span id="local-6989586621680788521"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680788521"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; PlainGhcException
</span><a href="GHC.Utils.Panic.Plain.html#PlainSignal"><span class="hs-identifier hs-var">PlainSignal</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680788521"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-138"></span><span>  </span><span class="annot"><a href="GHC.Utils.Panic.html#UsageError"><span class="hs-identifier hs-type">UsageError</span></a></span><span> </span><span id="local-6989586621680788520"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788520"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; PlainGhcException
</span><a href="GHC.Utils.Panic.Plain.html#PlainUsageError"><span class="hs-identifier hs-var">PlainUsageError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788520"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-139"></span><span>  </span><span class="annot"><a href="GHC.Utils.Panic.html#CmdLineError"><span class="hs-identifier hs-type">CmdLineError</span></a></span><span> </span><span id="local-6989586621680788519"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788519"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; PlainGhcException
</span><a href="GHC.Utils.Panic.Plain.html#PlainCmdLineError"><span class="hs-identifier hs-var">PlainCmdLineError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788519"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-140"></span><span>  </span><span class="annot"><a href="GHC.Utils.Panic.html#Panic"><span class="hs-identifier hs-type">Panic</span></a></span><span> </span><span id="local-6989586621680788518"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788518"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; PlainGhcException
</span><a href="GHC.Utils.Panic.Plain.html#PlainPanic"><span class="hs-identifier hs-var">PlainPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788518"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-141"></span><span>  </span><span class="annot"><a href="GHC.Utils.Panic.html#Sorry"><span class="hs-identifier hs-type">Sorry</span></a></span><span> </span><span id="local-6989586621680788517"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788517"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; PlainGhcException
</span><a href="GHC.Utils.Panic.Plain.html#PlainSorry"><span class="hs-identifier hs-var">PlainSorry</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788517"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-142"></span><span>  </span><span class="annot"><a href="GHC.Utils.Panic.html#InstallationError"><span class="hs-identifier hs-type">InstallationError</span></a></span><span> </span><span id="local-6989586621680788516"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788516"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; PlainGhcException
</span><a href="GHC.Utils.Panic.Plain.html#PlainInstallationError"><span class="hs-identifier hs-var">PlainInstallationError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788516"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-143"></span><span>  </span><span class="annot"><a href="GHC.Utils.Panic.html#ProgramError"><span class="hs-identifier hs-type">ProgramError</span></a></span><span> </span><span id="local-6989586621680788515"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788515"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; PlainGhcException
</span><a href="GHC.Utils.Panic.Plain.html#PlainProgramError"><span class="hs-identifier hs-var">PlainProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788515"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span>  </span><span class="annot"><a href="GHC.Utils.Panic.html#PprPanic"><span class="hs-identifier hs-type">PprPanic</span></a></span><span> </span><span id="local-6989586621680788514"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788514"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span id="local-6989586621680788513"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680788513"><span class="hs-identifier hs-var">sdoc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; PlainGhcException
</span><a href="GHC.Utils.Panic.Plain.html#PlainPanic"><span class="hs-identifier hs-var">PlainPanic</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; PlainGhcException) -&gt; String -&gt; PlainGhcException
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-146"></span><span>      </span><span class="annot"><span class="annottext">[String] -&gt; String
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788514"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\n\n&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDocUnsafe"><span class="hs-identifier hs-var">showSDocUnsafe</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680788513"><span class="hs-identifier hs-var">sdoc</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-147"></span><span>  </span><span class="annot"><a href="GHC.Utils.Panic.html#PprSorry"><span class="hs-identifier hs-type">PprSorry</span></a></span><span> </span><span id="local-6989586621680788511"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788511"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span id="local-6989586621680788510"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680788510"><span class="hs-identifier hs-var">sdoc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; PlainGhcException
</span><a href="GHC.Utils.Panic.Plain.html#PlainProgramError"><span class="hs-identifier hs-var">PlainProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; PlainGhcException) -&gt; String -&gt; PlainGhcException
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-148"></span><span>      </span><span class="annot"><span class="annottext">[String] -&gt; String
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788511"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\n\n&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDocUnsafe"><span class="hs-identifier hs-var">showSDocUnsafe</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680788510"><span class="hs-identifier hs-var">sdoc</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-149"></span><span>  </span><span class="annot"><a href="GHC.Utils.Panic.html#PprProgramError"><span class="hs-identifier hs-type">PprProgramError</span></a></span><span> </span><span id="local-6989586621680788509"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788509"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span id="local-6989586621680788508"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680788508"><span class="hs-identifier hs-var">sdoc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; PlainGhcException
</span><a href="GHC.Utils.Panic.Plain.html#PlainProgramError"><span class="hs-identifier hs-var">PlainProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; PlainGhcException) -&gt; String -&gt; PlainGhcException
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-150"></span><span>      </span><span class="annot"><span class="annottext">[String] -&gt; String
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788509"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\n\n&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; String
</span><a href="GHC.Utils.Outputable.html#showSDocUnsafe"><span class="hs-identifier hs-var">showSDocUnsafe</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680788508"><span class="hs-identifier hs-var">sdoc</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span id="local-6989586621680788697"><span class="annot"><a href="GHC.Utils.Panic.html#throwGhcException"><span class="hs-identifier hs-type">throwGhcException</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#GhcException"><span class="hs-identifier hs-type">GhcException</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680788697"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-153"></span><span id="throwGhcException"><span class="annot"><span class="annottext">throwGhcException :: forall a. GhcException -&gt; a
</span><a href="GHC.Utils.Panic.html#throwGhcException"><span class="hs-identifier hs-var hs-var">throwGhcException</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; a
forall a e. Exception e =&gt; e -&gt; a
</span><a href="../../base/src/GHC.Exception.html#throw"><span class="hs-identifier hs-var">Exception.throw</span></a></span><span>
</span><span id="line-154"></span><span>
</span><span id="line-155"></span><span id="local-6989586621680788692"><span class="annot"><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-type">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#GhcException"><span class="hs-identifier hs-type">GhcException</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621680788692"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-156"></span><span id="throwGhcExceptionIO"><span class="annot"><span class="annottext">throwGhcExceptionIO :: forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var hs-var">throwGhcExceptionIO</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO a
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">Exception.throwIO</span></a></span><span>
</span><span id="line-157"></span><span>
</span><span id="line-158"></span><span id="local-6989586621680788686"><span id="local-6989586621680788688"><span class="annot"><a href="GHC.Utils.Panic.html#handleGhcException"><span class="hs-identifier hs-type">handleGhcException</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Exception.html#ExceptionMonad"><span class="hs-identifier hs-type">ExceptionMonad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680788688"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Panic.html#GhcException"><span class="hs-identifier hs-type">GhcException</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680788688"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680788686"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680788688"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680788686"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680788688"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680788686"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-159"></span><span id="handleGhcException"><span class="annot"><span class="annottext">handleGhcException :: forall (m :: * -&gt; *) a.
ExceptionMonad m =&gt;
(GhcException -&gt; m a) -&gt; m a -&gt; m a
</span><a href="GHC.Utils.Panic.html#handleGhcException"><span class="hs-identifier hs-var hs-var">handleGhcException</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GhcException -&gt; m a) -&gt; m a -&gt; m a
forall (m :: * -&gt; *) e a.
(MonadCatch m, Exception e) =&gt;
(e -&gt; m a) -&gt; m a -&gt; m a
</span><a href="../../exceptions/src/Control.Monad.Catch.html#handle"><span class="hs-identifier hs-var">MC.handle</span></a></span><span>
</span><span id="line-160"></span><span>
</span><span id="line-161"></span><span id="local-6989586621680788675"><span class="annot"><a href="GHC.Utils.Panic.html#panicDoc"><span class="hs-identifier hs-type">panicDoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#sorryDoc"><span class="hs-identifier hs-type">sorryDoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#pgmErrorDoc"><span class="hs-identifier hs-type">pgmErrorDoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680788675"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-162"></span><span id="panicDoc"><span class="annot"><span class="annottext">panicDoc :: forall a. String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Panic.html#panicDoc"><span class="hs-identifier hs-var hs-var">panicDoc</span></a></span></span><span>    </span><span id="local-6989586621680788497"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788497"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621680788496"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680788496"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; a
forall a. GhcException -&gt; a
</span><a href="GHC.Utils.Panic.html#throwGhcException"><span class="hs-identifier hs-var">throwGhcException</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#PprPanic"><span class="hs-identifier hs-var">PprPanic</span></a></span><span>        </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788497"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680788496"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-163"></span><span id="sorryDoc"><span class="annot"><span class="annottext">sorryDoc :: forall a. String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Panic.html#sorryDoc"><span class="hs-identifier hs-var hs-var">sorryDoc</span></a></span></span><span>    </span><span id="local-6989586621680788495"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788495"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621680788494"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680788494"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; a
forall a. GhcException -&gt; a
</span><a href="GHC.Utils.Panic.html#throwGhcException"><span class="hs-identifier hs-var">throwGhcException</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#PprSorry"><span class="hs-identifier hs-var">PprSorry</span></a></span><span>        </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788495"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680788494"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-164"></span><span id="pgmErrorDoc"><span class="annot"><span class="annottext">pgmErrorDoc :: forall a. String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Panic.html#pgmErrorDoc"><span class="hs-identifier hs-var hs-var">pgmErrorDoc</span></a></span></span><span> </span><span id="local-6989586621680788493"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788493"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621680788492"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680788492"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; a
forall a. GhcException -&gt; a
</span><a href="GHC.Utils.Panic.html#throwGhcException"><span class="hs-identifier hs-var">throwGhcException</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#PprProgramError"><span class="hs-identifier hs-var">PprProgramError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680788493"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680788492"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-165"></span><span>
</span><span id="line-166"></span><span class="hs-comment">-- | Like try, but pass through UserInterrupt and Panic exceptions.</span><span>
</span><span id="line-167"></span><span class="hs-comment">--   Used when we want soft failures when reading interface files, for example.</span><span>
</span><span id="line-168"></span><span class="hs-comment">--   TODO: I'm not entirely sure if this is catching what we really want to catch</span><span>
</span><span id="line-169"></span><span id="local-6989586621680788671"><span class="annot"><a href="GHC.Utils.Panic.html#tryMost"><span class="hs-identifier hs-type">tryMost</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621680788671"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Exception.Type.html#SomeException"><span class="hs-identifier hs-type">SomeException</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680788671"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-170"></span><span id="tryMost"><span class="annot"><span class="annottext">tryMost :: forall a. IO a -&gt; IO (Either SomeException a)
</span><a href="GHC.Utils.Panic.html#tryMost"><span class="hs-identifier hs-var hs-var">tryMost</span></a></span></span><span> </span><span id="local-6989586621680788480"><span class="annot"><span class="annottext">IO a
</span><a href="#local-6989586621680788480"><span class="hs-identifier hs-var">action</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680788479"><span class="annot"><span class="annottext">Either SomeException a
</span><a href="#local-6989586621680788479"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO a -&gt; IO (Either SomeException a)
forall e a. Exception e =&gt; IO a -&gt; IO (Either e a)
</span><a href="../../base/src/Control.Exception.Base.html#try"><span class="hs-identifier hs-var">try</span></a></span><span> </span><span class="annot"><span class="annottext">IO a
</span><a href="#local-6989586621680788480"><span class="hs-identifier hs-var">action</span></a></span><span>
</span><span id="line-171"></span><span>                    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Either SomeException a
</span><a href="#local-6989586621680788479"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-172"></span><span>                        </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621680788478"><span class="annot"><span class="annottext">SomeException
</span><a href="#local-6989586621680788478"><span class="hs-identifier hs-var">se</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-173"></span><span>                            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">SomeException -&gt; Maybe GhcException
forall e. Exception e =&gt; SomeException -&gt; Maybe e
</span><a href="../../base/src/GHC.Exception.Type.html#fromException"><span class="hs-identifier hs-var">fromException</span></a></span><span> </span><span class="annot"><span class="annottext">SomeException
</span><a href="#local-6989586621680788478"><span class="hs-identifier hs-var">se</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-174"></span><span>                                </span><span class="hs-comment">-- Some GhcException's we rethrow,</span><span>
</span><span id="line-175"></span><span>                                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Panic.html#Signal"><span class="hs-identifier hs-type">Signal</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SomeException -&gt; IO (Either SomeException a)
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="annot"><span class="annottext">SomeException
</span><a href="#local-6989586621680788478"><span class="hs-identifier hs-var">se</span></a></span><span>
</span><span id="line-176"></span><span>                                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Panic.html#Panic"><span class="hs-identifier hs-type">Panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SomeException -&gt; IO (Either SomeException a)
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="annot"><span class="annottext">SomeException
</span><a href="#local-6989586621680788478"><span class="hs-identifier hs-var">se</span></a></span><span>
</span><span id="line-177"></span><span>                                </span><span class="hs-comment">-- others we return</span><span>
</span><span id="line-178"></span><span>                                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="annot"><span class="annottext">GhcException
</span><span class="hs-identifier">_</span></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Either SomeException a -&gt; IO (Either SomeException a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SomeException -&gt; Either SomeException a
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">SomeException
</span><a href="#local-6989586621680788478"><span class="hs-identifier hs-var">se</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-179"></span><span>                                </span><span class="annot"><span class="annottext">Maybe GhcException
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-180"></span><span>                                    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">SomeException -&gt; Maybe IOException
forall e. Exception e =&gt; SomeException -&gt; Maybe e
</span><a href="../../base/src/GHC.Exception.Type.html#fromException"><span class="hs-identifier hs-var">fromException</span></a></span><span> </span><span class="annot"><span class="annottext">SomeException
</span><a href="#local-6989586621680788478"><span class="hs-identifier hs-var">se</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-181"></span><span>                                        </span><span class="hs-comment">-- All IOExceptions are returned</span><span>
</span><span id="line-182"></span><span>                                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IOException
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Exception.html#IOException"><span class="hs-identifier hs-type">IOException</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-183"></span><span>                                            </span><span class="annot"><span class="annottext">Either SomeException a -&gt; IO (Either SomeException a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SomeException -&gt; Either SomeException a
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">SomeException
</span><a href="#local-6989586621680788478"><span class="hs-identifier hs-var">se</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-184"></span><span>                                        </span><span class="hs-comment">-- Anything else is rethrown</span><span>
</span><span id="line-185"></span><span>                                        </span><span class="annot"><span class="annottext">Maybe IOException
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SomeException -&gt; IO (Either SomeException a)
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="annot"><span class="annottext">SomeException
</span><a href="#local-6989586621680788478"><span class="hs-identifier hs-var">se</span></a></span><span>
</span><span id="line-186"></span><span>                        </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621680788477"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680788477"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Either SomeException a -&gt; IO (Either SomeException a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Either SomeException a
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680788477"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span class="hs-comment">-- | We use reference counting for signal handlers</span><span>
</span><span id="line-189"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html#signalHandlersRefCount"><span class="hs-pragma hs-type">signalHandlersRefCount</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#if !defined(mingw32_HOST_OS)
</span><span class="hs-identifier">signalHandlersRefCount</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MVar</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Word</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">S.Handler</span><span class="hs-special">,</span><span class="hs-identifier">S.Handler</span><span>
</span><span id="line-192"></span><span>                                            </span><span class="hs-special">,</span><span class="hs-identifier">S.Handler</span><span class="hs-special">,</span><span class="hs-identifier">S.Handler</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span class="annot"><a href="GHC.Utils.Panic.html#signalHandlersRefCount"><span class="hs-identifier hs-type">signalHandlersRefCount</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.MVar.html#MVar"><span class="hs-identifier hs-type">MVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Word</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.ConsoleHandler.html#Handler"><span class="hs-identifier hs-type">S.Handler</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span id="signalHandlersRefCount"><span class="annot"><span class="annottext">signalHandlersRefCount :: MVar (Word, Maybe Handler)
</span><a href="GHC.Utils.Panic.html#signalHandlersRefCount"><span class="hs-identifier hs-var hs-var">signalHandlersRefCount</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO (MVar (Word, Maybe Handler)) -&gt; MVar (Word, Maybe Handler)
forall a. IO a -&gt; a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafePerformIO"><span class="hs-identifier hs-var">unsafePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (MVar (Word, Maybe Handler)) -&gt; MVar (Word, Maybe Handler))
-&gt; IO (MVar (Word, Maybe Handler)) -&gt; MVar (Word, Maybe Handler)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Word, Maybe Handler) -&gt; IO (MVar (Word, Maybe Handler))
forall a. a -&gt; IO (MVar a)
</span><a href="../../base/src/GHC.MVar.html#newMVar"><span class="hs-identifier hs-var">newMVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Maybe Handler
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-197"></span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span class="hs-comment">-- | Temporarily install standard signal handlers for catching ^C, which just</span><span>
</span><span id="line-200"></span><span class="hs-comment">-- throw an exception in the current thread.</span><span>
</span><span id="line-201"></span><span id="local-6989586621680788661"><span id="local-6989586621680788662"><span class="annot"><a href="GHC.Utils.Panic.html#withSignalHandlers"><span class="hs-identifier hs-type">withSignalHandlers</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Exception.html#ExceptionMonad"><span class="hs-identifier hs-type">ExceptionMonad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680788662"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680788662"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680788661"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680788662"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680788661"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-202"></span><span id="withSignalHandlers"><span class="annot"><span class="annottext">withSignalHandlers :: forall (m :: * -&gt; *) a. ExceptionMonad m =&gt; m a -&gt; m a
</span><a href="GHC.Utils.Panic.html#withSignalHandlers"><span class="hs-identifier hs-var hs-var">withSignalHandlers</span></a></span></span><span> </span><span id="local-6989586621680788457"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680788457"><span class="hs-identifier hs-var">act</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-203"></span><span>  </span><span id="local-6989586621680788456"><span class="annot"><span class="annottext">ThreadId
</span><a href="#local-6989586621680788456"><span class="hs-identifier hs-var">main_thread</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO ThreadId -&gt; m ThreadId
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">IO ThreadId
</span><a href="../../base/src/GHC.Conc.Sync.html#myThreadId"><span class="hs-identifier hs-var">myThreadId</span></a></span><span>
</span><span id="line-204"></span><span>  </span><span id="local-6989586621680788453"><span class="annot"><span class="annottext">Weak ThreadId
</span><a href="#local-6989586621680788453"><span class="hs-identifier hs-var">wtid</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO (Weak ThreadId) -&gt; m (Weak ThreadId)
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ThreadId -&gt; IO (Weak ThreadId)
</span><a href="../../base/src/GHC.Conc.Sync.html#mkWeakThreadId"><span class="hs-identifier hs-var">mkWeakThreadId</span></a></span><span> </span><span class="annot"><span class="annottext">ThreadId
</span><a href="#local-6989586621680788456"><span class="hs-identifier hs-var">main_thread</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-205"></span><span>
</span><span id="line-206"></span><span>  </span><span class="hs-keyword">let</span><span>
</span><span id="line-207"></span><span>      </span><span id="local-6989586621680788447"><span class="annot"><span class="annottext">interrupt :: IO ()
</span><a href="#local-6989586621680788447"><span class="hs-identifier hs-var hs-var">interrupt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-208"></span><span>        </span><span id="local-6989586621680788446"><span class="annot"><span class="annottext">Maybe ThreadId
</span><a href="#local-6989586621680788446"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Weak ThreadId -&gt; IO (Maybe ThreadId)
forall v. Weak v -&gt; IO (Maybe v)
</span><a href="../../base/src/GHC.Weak.html#deRefWeak"><span class="hs-identifier hs-var">deRefWeak</span></a></span><span> </span><span class="annot"><span class="annottext">Weak ThreadId
</span><a href="#local-6989586621680788453"><span class="hs-identifier hs-var">wtid</span></a></span><span>
</span><span id="line-209"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe ThreadId
</span><a href="#local-6989586621680788446"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-210"></span><span>          </span><span class="annot"><span class="annottext">Maybe ThreadId
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-211"></span><span>          </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680788445"><span class="annot"><span class="annottext">ThreadId
</span><a href="#local-6989586621680788445"><span class="hs-identifier hs-var">t</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ThreadId -&gt; AsyncException -&gt; IO ()
forall e. Exception e =&gt; ThreadId -&gt; e -&gt; IO ()
</span><a href="../../base/src/GHC.Conc.Sync.html#throwTo"><span class="hs-identifier hs-var">throwTo</span></a></span><span> </span><span class="annot"><span class="annottext">ThreadId
</span><a href="#local-6989586621680788445"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">AsyncException
</span><a href="../../base/src/GHC.IO.Exception.html#UserInterrupt"><span class="hs-identifier hs-var">UserInterrupt</span></a></span><span class="hs-cpp">

#if !defined(mingw32_HOST_OS)
</span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">installHandlers</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-215"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">installHandler'</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-identifier">b</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">installHandler</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-identifier">b</span><span> </span><span class="hs-identifier">Nothing</span><span>
</span><span id="line-216"></span><span>        </span><span class="hs-identifier">hdlQUIT</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">installHandler'</span><span> </span><span class="hs-identifier">sigQUIT</span><span>  </span><span class="hs-special">(</span><span class="hs-identifier">Catch</span><span> </span><span class="hs-identifier">interrupt</span><span class="hs-special">)</span><span>
</span><span id="line-217"></span><span>        </span><span class="hs-identifier">hdlINT</span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">installHandler'</span><span> </span><span class="hs-identifier">sigINT</span><span>   </span><span class="hs-special">(</span><span class="hs-identifier">Catch</span><span> </span><span class="hs-identifier">interrupt</span><span class="hs-special">)</span><span>
</span><span id="line-218"></span><span>        </span><span class="hs-comment">-- see #3656; in the future we should install these automatically for</span><span>
</span><span id="line-219"></span><span>        </span><span class="hs-comment">-- all Haskell programs in the same way that we install a ^C handler.</span><span>
</span><span id="line-220"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">fatal_signal</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">throwTo</span><span> </span><span class="hs-identifier">main_thread</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Signal</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-identifier">n</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-221"></span><span>        </span><span class="hs-identifier">hdlHUP</span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">installHandler'</span><span> </span><span class="hs-identifier">sigHUP</span><span>   </span><span class="hs-special">(</span><span class="hs-identifier">Catch</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fatal_signal</span><span> </span><span class="hs-identifier">sigHUP</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-222"></span><span>        </span><span class="hs-identifier">hdlTERM</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">installHandler'</span><span> </span><span class="hs-identifier">sigTERM</span><span>  </span><span class="hs-special">(</span><span class="hs-identifier">Catch</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fatal_signal</span><span> </span><span class="hs-identifier">sigTERM</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-223"></span><span>        </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">hdlQUIT</span><span class="hs-special">,</span><span class="hs-identifier">hdlINT</span><span class="hs-special">,</span><span class="hs-identifier">hdlHUP</span><span class="hs-special">,</span><span class="hs-identifier">hdlTERM</span><span class="hs-special">)</span><span>
</span><span id="line-224"></span><span>
</span><span id="line-225"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">uninstallHandlers</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">hdlQUIT</span><span class="hs-special">,</span><span class="hs-identifier">hdlINT</span><span class="hs-special">,</span><span class="hs-identifier">hdlHUP</span><span class="hs-special">,</span><span class="hs-identifier">hdlTERM</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-226"></span><span>        </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">installHandler</span><span> </span><span class="hs-identifier">sigQUIT</span><span>  </span><span class="hs-identifier">hdlQUIT</span><span> </span><span class="hs-identifier">Nothing</span><span>
</span><span id="line-227"></span><span>        </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">installHandler</span><span> </span><span class="hs-identifier">sigINT</span><span>   </span><span class="hs-identifier">hdlINT</span><span>  </span><span class="hs-identifier">Nothing</span><span>
</span><span id="line-228"></span><span>        </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">installHandler</span><span> </span><span class="hs-identifier">sigHUP</span><span>   </span><span class="hs-identifier">hdlHUP</span><span>  </span><span class="hs-identifier">Nothing</span><span>
</span><span id="line-229"></span><span>        </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">installHandler</span><span> </span><span class="hs-identifier">sigTERM</span><span>  </span><span class="hs-identifier">hdlTERM</span><span> </span><span class="hs-identifier">Nothing</span><span>
</span><span id="line-230"></span><span>        </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span>  </span><span class="hs-comment">-- GHC 6.3+ has support for console events on Windows</span><span>
</span><span id="line-233"></span><span>  </span><span class="hs-comment">-- NOTE: running GHCi under a bash shell for some reason requires</span><span>
</span><span id="line-234"></span><span>  </span><span class="hs-comment">-- you to press Ctrl-Break rather than Ctrl-C to provoke</span><span>
</span><span id="line-235"></span><span>  </span><span class="hs-comment">-- an interrupt.  Ctrl-C is getting blocked somewhere, I don't know</span><span>
</span><span id="line-236"></span><span>  </span><span class="hs-comment">-- why --SDM 17/12/2004</span><span>
</span><span id="line-237"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680788442"><span class="annot"><span class="annottext">sig_handler :: ConsoleEvent -&gt; IO ()
</span><a href="#local-6989586621680788442"><span class="hs-identifier hs-var hs-var">sig_handler</span></a></span></span><span> </span><span class="annot"><span class="annottext">ConsoleEvent
</span><a href="../../base/src/GHC.Event.Windows.ConsoleEvent.html#ControlC"><span class="hs-identifier hs-var">ControlC</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO ()
</span><a href="#local-6989586621680788447"><span class="hs-identifier hs-var">interrupt</span></a></span><span>
</span><span id="line-238"></span><span>      </span><span class="annot"><a href="#local-6989586621680788442"><span class="hs-identifier hs-var">sig_handler</span></a></span><span> </span><span class="annot"><span class="annottext">ConsoleEvent
</span><a href="../../base/src/GHC.Event.Windows.ConsoleEvent.html#Break"><span class="hs-identifier hs-var">Break</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO ()
</span><a href="#local-6989586621680788447"><span class="hs-identifier hs-var">interrupt</span></a></span><span>
</span><span id="line-239"></span><span>      </span><span class="annot"><a href="#local-6989586621680788442"><span class="hs-identifier hs-var">sig_handler</span></a></span><span> </span><span class="annot"><span class="annottext">ConsoleEvent
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-240"></span><span>
</span><span id="line-241"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680788439"><span class="annot"><span class="annottext">installHandlers :: IO Handler
</span><a href="#local-6989586621680788439"><span class="hs-identifier hs-var hs-var">installHandlers</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handler -&gt; IO Handler
</span><a href="../../base/src/GHC.ConsoleHandler.html#installHandler"><span class="hs-identifier hs-var">installHandler</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ConsoleEvent -&gt; IO ()) -&gt; Handler
</span><a href="../../base/src/GHC.ConsoleHandler.html#Catch"><span class="hs-identifier hs-var">Catch</span></a></span><span> </span><span class="annot"><span class="annottext">ConsoleEvent -&gt; IO ()
</span><a href="#local-6989586621680788442"><span class="hs-identifier hs-var">sig_handler</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-242"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680788436"><span class="annot"><span class="annottext">uninstallHandlers :: Handler -&gt; IO Handler
</span><a href="#local-6989586621680788436"><span class="hs-identifier hs-var hs-var">uninstallHandlers</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handler -&gt; IO Handler
</span><a href="../../base/src/GHC.ConsoleHandler.html#installHandler"><span class="hs-identifier hs-var">installHandler</span></a></span><span> </span><span class="hs-comment">-- directly install the old handler</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-245"></span><span>  </span><span class="hs-comment">-- install signal handlers if necessary</span><span>
</span><span id="line-246"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680788425"><span class="annot"><span class="annottext">mayInstallHandlers :: m ()
</span><a href="#local-6989586621680788425"><span class="hs-identifier hs-var hs-var">mayInstallHandlers</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; m ()
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; m ()) -&gt; IO () -&gt; m ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">MVar (Word, Maybe Handler)
-&gt; ((Word, Maybe Handler) -&gt; IO (Word, Maybe Handler)) -&gt; IO ()
forall a. MVar a -&gt; (a -&gt; IO a) -&gt; IO ()
</span><a href="../../base/src/Control.Concurrent.MVar.html#modifyMVar_"><span class="hs-identifier hs-var">modifyMVar_</span></a></span><span> </span><span class="annot"><span class="annottext">MVar (Word, Maybe Handler)
</span><a href="GHC.Utils.Panic.html#signalHandlersRefCount"><span class="hs-identifier hs-var">signalHandlersRefCount</span></a></span><span> </span><span class="annot"><span class="annottext">(((Word, Maybe Handler) -&gt; IO (Word, Maybe Handler)) -&gt; IO ())
-&gt; ((Word, Maybe Handler) -&gt; IO (Word, Maybe Handler)) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-glyph">case</span><span>
</span><span id="line-247"></span><span>        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Maybe Handler
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-248"></span><span>          </span><span id="local-6989586621680788423"><span class="annot"><span class="annottext">Handler
</span><a href="#local-6989586621680788423"><span class="hs-identifier hs-var">hdls</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO Handler
</span><a href="#local-6989586621680788439"><span class="hs-identifier hs-var">installHandlers</span></a></span><span>
</span><span id="line-249"></span><span>          </span><span class="annot"><span class="annottext">(Word, Maybe Handler) -&gt; IO (Word, Maybe Handler)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">1</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Handler -&gt; Maybe Handler
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Handler
</span><a href="#local-6989586621680788423"><span class="hs-identifier hs-var">hdls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-250"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680788422"><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621680788422"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680788421"><span class="annot"><span class="annottext">Maybe Handler
</span><a href="#local-6989586621680788421"><span class="hs-identifier hs-var">oldHandlers</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Word, Maybe Handler) -&gt; IO (Word, Maybe Handler)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621680788422"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">Word -&gt; Word -&gt; Word
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">1</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Maybe Handler
</span><a href="#local-6989586621680788421"><span class="hs-identifier hs-var">oldHandlers</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-251"></span><span>
</span><span id="line-252"></span><span>  </span><span class="hs-comment">-- uninstall handlers if necessary</span><span>
</span><span id="line-253"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680788410"><span class="annot"><span class="annottext">mayUninstallHandlers :: m ()
</span><a href="#local-6989586621680788410"><span class="hs-identifier hs-var hs-var">mayUninstallHandlers</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO () -&gt; m ()
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; m ()) -&gt; IO () -&gt; m ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">MVar (Word, Maybe Handler)
-&gt; ((Word, Maybe Handler) -&gt; IO (Word, Maybe Handler)) -&gt; IO ()
forall a. MVar a -&gt; (a -&gt; IO a) -&gt; IO ()
</span><a href="../../base/src/Control.Concurrent.MVar.html#modifyMVar_"><span class="hs-identifier hs-var">modifyMVar_</span></a></span><span> </span><span class="annot"><span class="annottext">MVar (Word, Maybe Handler)
</span><a href="GHC.Utils.Panic.html#signalHandlersRefCount"><span class="hs-identifier hs-var">signalHandlersRefCount</span></a></span><span> </span><span class="annot"><span class="annottext">(((Word, Maybe Handler) -&gt; IO (Word, Maybe Handler)) -&gt; IO ())
-&gt; ((Word, Maybe Handler) -&gt; IO (Word, Maybe Handler)) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-glyph">case</span><span>
</span><span id="line-254"></span><span>        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">1</span></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680788409"><span class="annot"><span class="annottext">Handler
</span><a href="#local-6989586621680788409"><span class="hs-identifier hs-var">hdls</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-255"></span><span>          </span><span class="annot"><span class="annottext">Handler
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handler -&gt; IO Handler
</span><a href="#local-6989586621680788436"><span class="hs-identifier hs-var">uninstallHandlers</span></a></span><span> </span><span class="annot"><span class="annottext">Handler
</span><a href="#local-6989586621680788409"><span class="hs-identifier hs-var">hdls</span></a></span><span>
</span><span id="line-256"></span><span>          </span><span class="annot"><span class="annottext">(Word, Maybe Handler) -&gt; IO (Word, Maybe Handler)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Maybe Handler
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-257"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680788408"><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621680788408"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680788407"><span class="annot"><span class="annottext">Maybe Handler
</span><a href="#local-6989586621680788407"><span class="hs-identifier hs-var">oldHandlers</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Word, Maybe Handler) -&gt; IO (Word, Maybe Handler)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word
</span><a href="#local-6989586621680788408"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">Word -&gt; Word -&gt; Word
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Word
</span><span class="hs-number">1</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Maybe Handler
</span><a href="#local-6989586621680788407"><span class="hs-identifier hs-var">oldHandlers</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-258"></span><span>
</span><span id="line-259"></span><span>  </span><span class="annot"><span class="annottext">m ()
</span><a href="#local-6989586621680788425"><span class="hs-identifier hs-var">mayInstallHandlers</span></a></span><span>
</span><span id="line-260"></span><span>  </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621680788457"><span class="hs-identifier hs-var">act</span></a></span><span> </span><span class="annot"><span class="annottext">m a -&gt; m () -&gt; m a
forall (m :: * -&gt; *) a b. MonadMask m =&gt; m a -&gt; m b -&gt; m a
</span><a href="../../exceptions/src/Control.Monad.Catch.html#finally"><span class="hs-operator hs-var">`MC.finally`</span></a></span><span> </span><span class="annot"><span class="annottext">m ()
</span><a href="#local-6989586621680788410"><span class="hs-identifier hs-var">mayUninstallHandlers</span></a></span><span>
</span><span id="line-261"></span></pre></body></html>